#include <stdio.h>

#define TRACE(x...) 
#define PRINT(x...) TRACE(printf(x))

int n;
int graph[55][55];
int a, b;
int aisbest;

int main() {
	scanf("%d", &n);

	PRINT("%d\n", n);

	for (int i=0; i<n; i++)
		for (int j=0; j<n; j++)
			graph[i][j]=-1;

	
	for (int i=0; i<(n*(n-1)/2-1); i++) {
		scanf("%d %d", &a, &b);
		a--; b--;		

		graph[a][b]=1;
		graph[b][a]=0;
	}

	TRACE(
		for (int i=0; i<n; i++) {
			for (int j=0; j<n; j++)
				printf("%d ", graph[i][j]);
			printf("\n");
		}
		printf("\n");
	)

	for (int i=0; i<n; i++)
		for (int j=0; j<n; j++)
			if (i!=j && graph[i][j]==-1) {
				a=i; b=j;
			}

	PRINT("%d %d\n", a, b);

	aisbest=1;

	for (int i=0; i<n; i++) {
		if (graph[a][i]==graph[b][i]) continue;
		if (graph[a][i]==1 && graph[b][i]==0) break;
		else {
			aisbest=0; break;
		}		
	}

	if (aisbest) printf("%d %d\n", a+1, b+1);
	else printf("%d %d\n", b+1, a+1);

	return 0;
}
